import threading
import time


def do(event):
    while True:
        event.wait()
        print(time.time())
        time.sleep(1)


if __name__ == "__main__":
    event_obj = threading.Event()  # 创建一个事件
    event_obj.set()

    t1 = threading.Thread(target=do, args=(event_obj,))
    t1.setDaemon(True)
    t1.start()

    time.sleep(5)
    event_obj.clear()
    print("cleared, child thread is waiting...")
    time.sleep(2)
    print("end")
